import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;

public class SqlConnect {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        while(s.hasNextLine()) {
            int n = Integer.parseInt(s.nextLine());
            int max = 0;
            Deque<String> stack = new LinkedList<>();
            for(int i = 0; i < n; i++) {
                String str = s.nextLine();
                String[] strs = str.split(" ");
                if(strs[1].equals("connect")) {
                    stack.push(strs[0]);
                    max = Math.max(max,stack.size());
                }else {
                    stack.pop();
                }
            }
            System.out.println(max);
        }
    }
}
